// 渲染背景
function drawBg(ctx) {
	ctx.drawImage(document.getElementById("bgImage"), 0, 0, CANVAS_WIGHT, CANVAS_HEIGHT);
}

// 渲染点
function drawPoint(ctx, point) {
	var r = 10;
	ctx.beginPath();
	// 判断是否是起点或终点
	if(point.type != undefined) {
		var content = "";
		var sel = "";
		switch(point.type) {
			case 0:
				return;
				break;
			case 1:
				ctx.fillStyle = sPointStyle.color;
				r = sPointStyle.r;
				sel = "#sPoint";
				var content = "起点";
				break;
			case 2:
				ctx.fillStyle = ePointStyle.color;
				r = ePointStyle.r;
				sel = "#ePoint";
				var content = "终点";
				break;
		}
		printPoint(sel, content, point);
	}
	ctx.arc(point.x, point.y, r, 0, 2 * Math.PI);
	ctx.fill();
}

// 渲染路线
function drawRoute(ctx) {
	if(routeReady) {
		ctx.beginPath();
		ctx.lineWidth = wayStyle.lineWidth;
		ctx.strokeStyle = wayStyle.color;
		ctx.moveTo(sPoint.x, sPoint.y);
		for(let i = 0; i < minRoutes.length; i++) {
			ctx.lineTo(minRoutes[i].x, minRoutes[i].y);
		}
		ctx.lineTo(ePoint.x, ePoint.y);
		ctx.stroke();
		ctx.closePath();
	}
}